import store from '../../store'

/** 根据角色id查找角色信息 */
export const getCharacterInfoById = id => {
  const { characterInfo } = store.state
  const one = characterInfo.find(item => item._id === id)
  return (
    one || {
      title: '未知角色'
    }
  )
}

export const isAdmin = () => {
  const uc = store.state.userCharacter
  return uc.name === 'admin'
}
